package com.chenxi.processor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * Bean后置处理器
 */
public class NASPostProcessor implements BeanPostProcessor  {

	public NASPostProcessor() {
		System.out.println("2-0、(BeanPostProcessor)Bean后置处理器...构造方法......");
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		if ("user".equals(beanName)) {
			System.out.println("2-1、(BeanPostProcessor)前置增强...postProcessBeforeInitialization方法......");
		}
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if ("user".equals(beanName)) {
			System.out.println("2-2、(BeanPostProcessor)后置增强...postProcessBeforeInitialization......");
		}
		return bean;
	}
}
